/*
 * SteepTimer - A timer designed for tea fanatics
 * Copyright (C) 2011  Wesley Crossman
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "TeaAboutDialog.h"
#include "ui_TeaAboutDialog.h"
#include <QFile>

TeaAboutDialog::TeaAboutDialog(QWidget *parent) :
            QDialog(parent, Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint),
            m_ui(new Ui::TeaAboutDialog),
            m_licenseRead(false) {
    m_ui->setupUi(this);
}

TeaAboutDialog::~TeaAboutDialog() {
    delete m_ui;
}

void TeaAboutDialog::on_btnLicenseAndCredits_clicked(bool checked) {
    if (!m_licenseRead) {
        QFile file(":/resources/license.html");
        file.open(QIODevice::ReadOnly);
        m_ui->brwLicense->setHtml(file.readAll());
        m_licenseRead = true;
    }

    m_ui->stackedWidget->setCurrentIndex(checked ? 1 : 0);
}
